package com.ninong.ker.log.conf;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 自动注入
 * @author cmd
 *
 */
@Component
public class BasicMetaObjectHandler implements MetaObjectHandler {

	@Override
	public void insertFill(MetaObject metaObject) {
		this.fillStrategy(metaObject, "createTime", new Date());
		this.fillStrategy(metaObject, "enabled", true);
		this.fillStrategy(metaObject, "deleted", true);
	}

	@Override
	public void updateFill(MetaObject metaObject) {	
		this.fillStrategy(metaObject, "updateTime", new Date());
	}

}
